<?php if(!defined('DB_NAME')) die();
if( $_GET['FromAjax'] ){
	echo '<div class="ajax-post">';
	if( $_GET['rand'] ){
		$rand_num = get('ini_rand') ? get('ini_rand') : 20;
		$rand_posts = get_posts("ignore_sticky_posts=1&numberposts=$rand_num&category=".get('ini_cat_id'));
		shuffle($rand_posts);
		$i=0; foreach( $rand_posts as $post) :
			if($i<8) :
				$i++;
				$colors = ini_color();
				$color = $colors[dechex( rand(0,8) )];
?>
				<a class="rand-item" href="<?php the_permalink()?>"><?php if(!get('ini_no_thumb')) echo ini_img(220,110)?><button<?php if(get('ini_no_thumb')) echo " style=top:0;background:$color"; ?>><?php the_title()?></button></a>
<?php
			endif;
		endforeach;
	}
	echo '</div>';
}
else if( get_query_var('paged') ) {
	include "archive.php";
}
else {
	get_header();
	if( get('ini_ggplus') ){
	echo "<a href=\"https://plus.google.com/".get('ini_ggplus')."?rel=author\"></a>";
	}
	if( !ismobile() ){
		if (get('ini_home')=="分类展示" && $obj_key ==$ini_key){
			include 'inc/cate.php';
		} else if (get('ini_home')=="博客布局" && $ini_key==$obj_key) {
			include 'inc/blog.php';
		} else {
			include 'inc/cms.php';
		}
	} else {
		include 'mp/index.php';
	}
	get_sidebar();
	get_footer();
}